home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: claus@faerber.muc.de (Claus A. Faerber)
- Newsgroups: comp.std.c++
- Subject: Re: String value of enum
- Date: 18 Mar 1996 09:47:51 PST
- Organization: -
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <6525BH4ocDB@faerber.muc.de>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Sun, 17 Mar 1996 01:00:00 +0100
- In-Reply-To: <4i5sf3$89c@hermes.is.co.za>
- X-Mailer: CrossPoint v3.1 R/B17071
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMU2h1Ey4NqrwXLNJAQGhCQIAzUNzr4dJh/+oxgy4YDDq637+NJIS2xjO
- vhVtsWw5LOVAv6pp3vCvUGWG+9bOdsuZzZkWET0ytwiAxu2k3H7Wmw==
- =QjjM
- Originator: austern@isolde.mti.sgi.com
-
- W. Dicks <wd@isis.co.za> (13 Mar 96):
-
- > The system that I'm working often needs to know the string
- > value of an enum. e.g. enum week{MON=1, ..., SUN} it; it =
- > TUE;
- > Then when this enum is passed as a parameter the function
- > should return the string based on the enum. For instance,
- > weekImage(it) will return "TUE". Is it not possible that such
- > a functionality can be built into enums?
-
- It is possible, but I would not appreciate it.
- If this were possible, it would make the program's output
- depend on internal variable/type names, which is generally
- not a good idea. Especially when you want to translate your
- program into other languages, it is easier to change this
- enum-to-string function (or even a seperate string table)
- instead of every line of code where this enum is used.
-
- Claus
-
- -------------------------------------------------------------------------
- Claus Andre Faerber - claus@faerber.muc.de - http://www.muc.de/~cfaerber/
- -------------------------------------------------------------------------
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-